﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FACUI.frmDialog
{
    public partial class frmErrDlg : Form
    {
        private int _secCount = 10;
        public frmErrDlg(string err,int secCount)
        {
            InitializeComponent();
            Point p = new Point();
            p.X = Screen.PrimaryScreen.WorkingArea.Width - base.Width;
            p.Y = Screen.PrimaryScreen.WorkingArea.Height - base.Height;
            this.Location = p;
            this.label1.Text = err;
            _secCount = secCount > 10 ? secCount : 10;
            System.Windows.Forms.Timer timer = new Timer();
            timer.Interval = 1000;
            timer.Enabled = true;
            timer.Tick += new EventHandler(timer_Tick);
        }

        void timer_Tick(object sender, EventArgs e)
        {
            if (--_secCount < 0) this.Dispose();
        }
    }
}
